package com.woniuxy.hrp.mapper;

import com.woniuxy.hrp.entity.Doctor;
import com.woniuxy.hrp.entity.Mrecord;
import com.woniuxy.hrp.entity.Patient;
import com.woniuxy.hrp.service.MrecordService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@SpringBootTest
@RunWith(SpringRunner.class)
public class TsetMrecode {
    @Autowired
    private MrecordMapper mrecodeMapper;
    @Autowired
    private MrecordService mrecordService;

    @Test
    public void insert() {
        Mrecord mrecord = new Mrecord();
        Doctor doctor = new Doctor();
        doctor.setId(1);
        Patient patient = new Patient();
        patient.setId(1);
        mrecord.setDoctor(doctor);
        mrecord.setPat(patient);
        mrecord.setMedicaladvice("fgxhad");
        mrecord.setDatetime("2022/10/22");
        mrecord.setPrescription("暂无");
        mrecodeMapper.insert(mrecord);
    }

    @Test
    public void seleByCon() {
        Mrecord mrecord = new Mrecord();
        Doctor doctor = new Doctor();
        doctor.setId(1);
        mrecord.setDoctor(doctor);
        mrecordService.seleByCo(mrecord).forEach(r -> {
            System.out.println(r.getMedicaladvice());
        });

    }

}
